self.onmessage = (e) =>{
    let chunks = [];
    const { file,  startIndex, endIndex,  splitSize, chunkCount, uuid,blob} = e.data;
    for(let i = startIndex ;i < endIndex; i++){
        let start = i * splitSize;
        let end = (i + 1) * splitSize;
        if(end > file.size){
            end = file.size;
        }
        const slicedBlob  = blob.slice(start,end);
        chunks.push({
            name: file.name,
            uuid: uuid,
            index: i,
            count: chunkCount,
            fileSize: file.size,
            data: slicedBlob
        });
    }
    self.postMessage(chunks);
}